<?xml version="1.0" encoding="UTF-8"?>
<TranscoderTask ID="{{taskId}}">
    <AVSettings>
        <FadeIn>0</FadeIn>
        <FadeOut>0</FadeOut>
        <FillModeLost>0</FillModeLost>
        <FillLostTime>0</FillLostTime>
        <VideoSettings Count="1">
            <VideoSetting idx="0">
                <ProcessMode>0</ProcessMode>
                <CodecType>H264</CodecType>
                <Encoding>Custom</Encoding>
                <Profile>High</Profile>
                <Level>Auto</Level>
                <Width>{{width}}</Width>
                <Height>{{height}}</Height>
                <FrameRate>-1</FrameRate>
                <FrameRateConversionMode>1</FrameRateConversionMode>
                <FrameRateSourceMode>0</FrameRateSourceMode>
                <RC>CBR</RC>
                <Quantizer>0</Quantizer>
                <BitRate>{{bitRate}}</BitRate>
                <MaxBitRate>0</MaxBitRate>
                <VBVSize>{{vbvSize}}</VBVSize>
                <VBVDelay>700</VBVDelay>
                <GopSize>100</GopSize>
                <GopType>0</GopType>
                <Scenedetection>0</Scenedetection>
                <GopMode>1</GopMode>
                <BFrame>0</BFrame>
                <ChromaFormat>420</ChromaFormat>
                <BitDepth>8</BitDepth>
                <CABAC>1</CABAC>
                <Transform8x8>1</Transform8x8>
                <Intra8x8>1</Intra8x8>
                <LoopFilter>1</LoopFilter>
                <RefFrame>1</RefFrame>
                <Interlace>-1</Interlace>
                <ThreadCount>5</ThreadCount>
                <LookHeadFrame>20</LookHeadFrame>
                <CAEQuality>1</CAEQuality>
                <Policy>
                    <TwoPass>0</TwoPass>

                    {{#if hasMergeVideo}}
                    <DeviceID>1</DeviceID>
                    <DeviceType>3</DeviceType>
                    {{else}}
                    <DeviceID>0</DeviceID>
                    {{/if}}

                    <QualityLevel>2</QualityLevel>
                </Policy>
                <SmartStretch>
                    <DAR_X>-1</DAR_X>
                    <DAR_Y>-1</DAR_Y>
                    <Operate>1</Operate>
                    <FillColor>0</FillColor>
                </SmartStretch>
                <ArcFrcInfo>
                    <Method>0</Method>
                    <Strategy>-1</Strategy>
                </ArcFrcInfo>
                <HDRType>0</HDRType>
                <ColorRange>0</ColorRange>
                <ColorPrimaries>0</ColorPrimaries>
                <LuminanceRange>0</LuminanceRange>
                <Deinterlace>2</Deinterlace>
                <Deblock>0</Deblock>
                <Delight>0</Delight>
                <Denoise>0</Denoise>
                <DenoiseMethod>0</DenoiseMethod>
                <Sharpen>0</Sharpen>
                <Dehaze>0</Dehaze>
                <AntiAlias>0</AntiAlias>
                <AntiShaking>-1</AntiShaking>
                <EdgeAA>0</EdgeAA>
                <Bright>0</Bright>
                <Contrast>0</Contrast>
                <Hue>0</Hue>
                <Saturation>0</Saturation>
                <ReSizeAlg>3</ReSizeAlg>
                <DeinterlaceAlg>3</DeinterlaceAlg>
                <AIResize>{{aiResizeMode}}</AIResize>
                <AIEnhancement>0</AIEnhancement>
                <AIDeblurring>0</AIDeblurring>
            </VideoSetting>
        </VideoSettings>
        <AudioSettings Count="1">
            <AudioSetting idx="0">
                <CodecType>AAC</CodecType>
                <Profile>LC</Profile>
                <PackageMode>1</PackageMode>
                <Channel>2</Channel>
                <BitRate>64000</BitRate>
                <SampleRate>32000</SampleRate>
                <Denoise>0</Denoise>
                <BoostLevel>0</BoostLevel>
                <ChannelProcessing>None</ChannelProcessing>
                <VolumeProcessMode>0</VolumeProcessMode>
                <BalanceDB>-30</BalanceDB>
                <BalanceLevel>0</BalanceLevel>
            </AudioSetting>
        </AudioSettings>
    </AVSettings>
    <OutputGroups Count="1">
        <OutputGroup idx="0" label="">
            <EnableOutput>1</EnableOutput>
            <OutputType>FileArchive</OutputType>
            <OutputCount>1</OutputCount>
            <Container>{{container}}</Container>
            <TargetPath>{{targetFileName}}</TargetPath>
            <SegmentMode>0</SegmentMode>
            <SegmentRecordPara>
                <SRDataOffset>5</SRDataOffset>
                <EpgInfoFilePath></EpgInfoFilePath>
            </SegmentRecordPara>
            {{#if hasMp4}}
            <MP4Setting>
                <FileHeadForemost>1</FileHeadForemost>
                <SplitAudio>0</SplitAudio>
                <SplitChannel>0</SplitChannel>
                <TargetPath>/</TargetPath>
                <TargetName>${II}</TargetName>
                <AutoStartEnd>0</AutoStartEnd>
            </MP4Setting>
            {{/if}}
            {{#if hasTs}}
            <TsSetting>
                <ServerName></ServerName>
                <ServiceProvider></ServiceProvider>
                <SericeId>0</SericeId>
                <PmtPid>0</PmtPid>
                <VideoPid>0</VideoPid>
                <AudioPid></AudioPid>
                <PcrPid>0</PcrPid>
                <TotalBitrate>{{totalBitRate}}</TotalBitrate>
                <BitRateMode>1</BitRateMode>
            </TsSetting>
            {{/if}}
            <Output idx="0" label="">
                <VideoSettingIdx>0</VideoSettingIdx>
                <AudioSettingIdx>0</AudioSettingIdx>
                <AudioInputIdx>-1</AudioInputIdx>
                <Subdirectory>0</Subdirectory>
                <HLSInfo>
                    <Type>0</Type>
                    <AudioGroupID></AudioGroupID>
                    <SubtitleGroupID></SubtitleGroupID>
                </HLSInfo>
            </Output>
        </OutputGroup>
    </OutputGroups>
    <Inputs Count="1">
        <Input idx="0">
            <FillType>0</FillType>
            <HSYQEdit>0</HSYQEdit>
            <VideoDecoding>0</VideoDecoding>
            <Type>LocalFile</Type>
            <URI>{{fileName}}</URI>
            <Program Id="0">
                <VideoId>-1</VideoId>
                <AudioId>-1</AudioId>
                <SubtitleId>-3</SubtitleId>
                <AudioChannelId>-1</AudioChannelId>
            </Program>
            {{#if hasMergeVideo}}
            <Preprocessor>
                <Times Count="{{times.length}}">
                    <NoRetain>0</NoRetain>
                    {{#each times}}
                    <Time idx="{{@index}}">
                        <Start>{{this.startTime}}</Start>
                        <Stop>{{this.endTime}}</Stop>
                    </Time>
                    {{/each}}
                </Times>
                <AudioDelay>0</AudioDelay>
                {{#if hasClipsVideo}}
                <Clips Count="{{clipsData.length}}">
                    {{#each clipsData}}
                    <Clip idx="{{@index}}">
                        <Type>LocalFile</Type>
                        <URI>{{this.clipFilePath}}</URI>
                        <InsertTime>{{this.clipInsertTime}}</InsertTime>
                        <Start>{{this.clipStartTime}}</Start>
                        <Stop>{{this.clipStopTime}}</Stop>
                    </Clip>
                    {{/each}}
                </Clips>
                {{/if}}
            </Preprocessor>
            {{/if}}
        </Input>
    </Inputs>
</TranscoderTask>
